var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, o) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var o in t)
              Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
          })(t, o);
      };
      return function (t, o) {
        function n() {
          this.constructor = t;
        }
        if ("function" != typeof o && null !== o)
          throw new TypeError(
            "Class extends value " + String(o) + " is not a constructor or null"
          );
        e(t, o),
          (t.prototype =
            null === o
              ? Object.create(o)
              : ((n.prototype = o.prototype), new n()));
      };
    })(),
  LookDetailView = (function (e) {
    function t() {
      var t = e.call(this) || this;
      return (
        t.btn_lookClose.on(Laya.Event.CLICK, t, t.clickHandler),
        WebSocketService.addListener({
          caller: t,
          code: 1060,
          method: t.onLoadItem1Data,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2099,
          method: t.onLoadItem1Data,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2083,
          method: t.onLoadItem1Data,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 2098,
          method: t.onLoadItemfujiangData,
        }),
        WebSocketService.addListener({
          caller: t,
          code: 6192,
          method: t.onLoadItemhundanData,
        }),
        t
      );
    }
    return (
      __extends(t, e),
      (t.showLookDetailView = function (e) {
        return (
          null == this.lookV &&
            ((this.lookV = new t()),
            (this.lookV.zOrder = 2e3),
            (this.lookV.x = 37),
            (this.lookV.y = 100)),
          Laya.stage.addChild(this.lookV),
          (this.lookV.label_lookTitle.text = e.name),
          (this.lookV.label_lookContent.text = ""),
          "5" == e.thingtype
            ? WebSocketService.send({ c: 2099, d: { id: e.thingid } })
            : "4" == e.thingtype ||
              ("3" == e.thingtype
                ? WebSocketService.send({ c: 2098, d: { id: e.thingid } })
                : "2" == e.thingtype
                ? WebSocketService.send({ c: 2083, d: { id: e.thingid } })
                : "1" == e.thingtype
                ? WebSocketService.send({ c: 1060, d: { gid: e.thingid } })
                : "6" == e.thingtype &&
                  WebSocketService.send({ c: 6192, d: { id: e.thingid } })),
          this.lookV
        );
      }),
      (t.prototype.onLoadItem1Data = function (e) {
        if (0 == e.code) {
          for (var t = "", o = "", n = "", i = 0; i < e.data.length; i++) {
            var a = e.data[i],
              r = a.k,
              l = a.v;
            "图片：" != r &&
              "图片:" != r &&
              ("roleName:" != r
                ? "roleId:" != r
                  ? (t = t + r + " " + l + "\n")
                  : (n = l)
                : (o = l));
          }
          (this.label_lookTitle.text = o + "(" + n + ")"),
            (this.label_lookContent.text = t);
        }
      }),
      (t.prototype.onLoadItemfujiangData = function (e) {
        if (0 == e.code) {
          var t = e.data,
            o = "";
          (o =
            (o =
              (o = (o = "名称：" + t.name + "\n") + "等级：" + t.lvl + "\n") +
              "气血：" +
              t.hp +
              "/" +
              t.maxHp +
              "\n") +
            "精力：" +
            t.mp +
            "/" +
            t.maxMp +
            "\n"),
            (this.label_lookContent.text = o);
        }
      }),
      (t.prototype.onLoadItemhundanData = function (e) {
        if (0 == e.code) {
          var t = e.data,
            o = "职业：" + this.dealZhiYeString(t.t),
            n = "状态：" + (1 == t.ss ? "已激活" : "归元"),
            i = "效果：" + t.descr,
            a = "魂值：" + t.e + "/" + t.eUp,
            r = "升级耗银：" + t.silver;
          this.label_lookContent.text =
            o + "\n" + n + "\n" + i + "\n" + a + "\n" + r;
        }
      }),
      (t.prototype.dealZhiYeString = function (e) {
        var t = "";
        return (
          1 == e
            ? (t = "武士")
            : 2 == e
            ? (t = "文人")
            : 3 == e && (t = "异人"),
          t
        );
      }),
      (t.prototype.clickHandler = function () {
        this.removeSelf();
      }),
      t
    );
  })(ui.EmailController.LookDetailViewUI);
